package com.book.store.present;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
public class BookStorePresentApplication {

    public static void main(String[] args) {
        SpringApplication.run(BookStorePresentApplication.class, args);
    }

    @Autowired
    private HttpMessageConverters httpMessageConverters;

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        // 与项目的 转换器 保持一致
        return new RestTemplate(httpMessageConverters.getConverters());
    }
}
